import request from "@/utils/request.js";

const url = '/cloud-sys-service/sys-user'

/**
 * 获取当前登录用户信息
 */
export function getCurrentUserInfo(data) {
	return request({
		url: url + "/getCurrentUserInfo",
		method: "get",
		params: data,
	})
}

/**
 * 获取用户分页列表
 */
export function list(data) {
	return request({
		url: url + "/list",
		method: "post",
		data,
	})
}

/**
 * 新增或修改用户
 */
export function save(data) {
	return request({
		url: url + "/save",
		method: "post",
		data
	});
}

/**
 * 删除用户
 */
export function remove(id) {
	return request({
		url: url + `/remove/${id}`,
		method: "get",
	});
}

/**
 * 重置密码
 */
export function resetPassword(id,params) {
	return request({
		url: url + `/resetPassword/${id}`,
		method: "get",
		params
	});
}

/**
 * 下载导入模板
 */
export function downloadTemplate() {
	return request({
		url: url + `/downloadTemplate`,
		method: "get",
		responseType:'blob'
	});
}

/**
 * 导入
 */
export function importExcel(params) {
	return request({
		url: url + `/downloadTemplate`,
		method: "get",
		params
	})
}

// 列表相关列信息
export const columnInfo = [
	{
		"title":"用户名",
		"field":"username",
		"fixed":"left",
		"align":"center",
		"minWidth":"100"
	},
	{
		"title":"用户昵称",
		"field":"nickname",
		"fixed":"left",
		"align":"center",
		"minWidth":"150"
	},
	{
		"title":"性别",
		"field":"genderTxt",
		"align":"center",
		"minWidth":"80"
	},
	{
		"title":"组织名称",
		"field":"orgIdTxt",
		"align":"center",
		"minWidth":"150"
	},
	{
		"title":"手机号码",
		"field":"mobile",
		"align":"center",
		"minWidth":"120"
	},
	{
		"title":"状态",
		"field":"status",
		"align":"center",
		"proxyColumn":true,
		"minWidth":"80"
	},
	{
		"title":"创建时间",
		"field":"createTime",
		"align":"center",
		"minWidth":"150"
	},
	{
		"title":"操作",
		"field":"operate",
		"fixed":"right",
		"align":"center",
		"proxyColumn":true,
		"minWidth":"220px",
		/*"options":[
			{
				"text":true,
				"btnName":"重置密码",
				"type":"primary",
				"icon":"RefreshLeft",
				"method":"showFormDialog"
			},
			{
				"text":true,
				"btnName":"编辑",
				"type":"primary",
				"icon":"Edit",
				"method":"showFormDialog"
			},
			{
				"text":true,
				"btnName":"删除",
				"type":"primary",
				"icon":"Delete",
				"method":"showRemoveDialog",
				"color":"#ff4949"
			}
		]*/
	}
]
